<script language="javascript" type="text/javascript" src="/assets/My97DatePicker/jquery-1.8.2.js"></script>
<script language="javascript" type="text/javascript" src="/assets/libs/fastadmin-layer/dist/layer.js"></script>
<script src="/ueditor/ueditor.config.js"></script>
<script src="/ueditor/ueditor.all.min.js"></script>
<script src="/ueditor/lang/zh-cn/zh-cn.js"></script>

<div class="content">
    <div class="panel panel-default panel-intro">
        <div class="panel-body">
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$res.id}"/>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">标题:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-title" class="form-control" name="title" value="{$res.title}" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">广告链接:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-linkto" class="form-control" name="linkto" value="{$res.linkto}" type="text">
        </div>
    </div>

    {if condition = '$sense_id eq 70'}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">显示位置:</label>
        <div class="col-xs-12 col-sm-8">
            <label>
              <input  name="home_post"  value="1" type="checkbox" {if condition = '$res.home_post eq 1'} checked='checked' {/if}> 首页显示  
            </label>  
            <label>
                
                <input  name="show_post"  value="1" type="checkbox"  {if condition = '$res.show_post eq 1'} checked='checked' {/if}> 详细页显示
            </label>  
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">图片上传:</label>
        <div class="col-xs-12 col-sm-8">
            <input  name="pic" type="file" style="float: left; width: 170px;"><img src="{$res.imgurl}" width="50" height="50" style="float: left;">
        </div>
    </div>
    {else/}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">产品id:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-p_id" class="form-control" name="p_id" value="{$res.p_id}"  type="text">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">标题2:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-title2" class="form-control" name="title2" value="{$res.title2}" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">图片:</label>
        <div class="col-xs-12 col-sm-8">
            <img src="{$res.imgurl}" alt=""  style="display: block; margin-bottom: 10px; width:200px;height:auto;" id="lod_pic"/>
            <input id="imgurl"  name="imgurl" type="hidden">
            <button type="button" onclick="img_sub();" style="display:block;">确定</button>
        </div>
    </div>
    {/if}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">页面打开方式:</label>
        <div class="col-xs-12 col-sm-8">
            <input  name="jumpwindow" type="radio" value="1" {if $res["jumpwindow"]==1}checked="checked" {/if} >本窗口打开
            <input  name="jumpwindow" type="radio" value="0" {if $res["jumpwindow"]==0}checked="checked" {/if} >新窗口打开
        </div>
    </div>
    {if condition = '$sense_id neq 70'}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">广告文字详情:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="info" name="info">{$res.info}</textarea>
        </div>
    </div>
    {/if}
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="button" class="btn btn-success btn-embossed" onclick="sub();">确认</button>
            <a  href="/admin/adsense/index_ad?id={$res.sense_id}" class="btn btn-default btn-embossed">返回</a>
        </div>
    </div>
</form>
</div>
</div>
</div>
<script>
    function img_sub() {
        var tr_id="{$resAd['width']}";
        var tri_id="{$resAd['height']}";
        var p_id="lod_pic";
        var flag=0;
        var url="/add_img.php?p_id="+p_id+"&tr_id="+tr_id+"&tri_id="+tri_id+"&flag="+flag;
        //alert(url);
        layer.open({
            type: 2,
            title:"图片裁切",
            shift: 2,
            area: ['100%', '100%'],
            //shadeClose: true,
            content: [url],
            scrollbar: true ,//屏蔽浏览器滚动条
        });
    }
    function sub() {
        var title=$("#c-title").val();
        if(title==''){
            layer.msg("标题不得为空");
            return;
        }
        var url=$("#lod_pic").attr("src");
        $("#imgurl").val(url);
        $("#edit-form").submit();

    }


</script>

<script type="text/javascript">
    UE.getEditor('info', {
        theme:"default", //皮肤
        lang:"zh-cn", //语言
        initialFrameWidth:1078,  //初始化编辑器宽度,默认800
        initialFrameHeight:320//  初始化编辑器高度
    });
</script>
